import Vue from 'vue'
import VueRouter from 'vue-router'

//0. 模块化编程
Vue.use(VueRouter)

//1.路由组件
import Home from '../views/Home.vue' //模块引入
// import Find from '../views/Find.vue'
// import Mine from '../views/Mine.vue'

//2.定义路由选项
const routes =[
  {
    path:"/",
    redirect:"/home"
  },
  {
    path:'/home',
    name:'home',
    component:Home
  },
  {
    path:'/Find',
    name:'find',
    component:()=>import('../views/Find.vue')// 路由懒加载
  },
  {
    path:'/Vuex',
    name:'vuex',
    component:()=>import('../views/Vuex.vue')
  },
  {
    path:'/Mine',
    name:'mine',
    component:()=>import('../views/Mine.vue')
  },
  {
    path:'*',
    redirect:'/home'
  }
]

//3.创建路由对象
const router = new VueRouter({
  mode:'history',
  routes,
  base:""
})

//4.挂载
export default router //模块暴露